package com.jinduplan.planmanager.ui.activity

import com.cxz.kotlin.baselibs.base.BaseActivity
import com.cxz.kotlin.baselibs.utils.LogUtil
import com.cxz.kotlin.baselibs.utils.Preference
import com.cxz.kotlin.baselibs.utils.RxTimerUtil
import com.jinduplan.planmanager.R
import com.jinduplan.planmanager.constant.Constant
import com.jinduplan.planmanager.ui.activity.user.LoginAcitivity
import com.jinduplan.planmanager.utils.ResUtil
import kotlinx.android.synthetic.main.dialog_safe_tips.*

class SplashActivity:BaseActivity() {

    override fun attachLayoutRes(): Int {
        return R.layout.activity_splash
    }


    override fun initView() {

    }
    var isLogin: Boolean by Preference(Constant.HAS_LOGIN, false)

    override fun start() {

        LogUtil.d("isLogin->$isLogin")
        RxTimerUtil.interval( 1000) {
            if (it >= 1.toLong()) {
                if (!isLogin) {
                    goActivity(LoginAcitivity::class.java)
                    RxTimerUtil.cancel()
                    this.finish()
                } else {
                    goActivity(MainActivity::class.java)
                    RxTimerUtil.cancel()
                    this.finish()
                }
            }
        }
    }
}